"""
@author: jiangpj
@email: pj.jiang@hzgosun.com
@file: gridUserManagePage.py
@time: 2019/6/3 9:51

"""
from common.poium import Page
from common.vue.button import VueButton
from common.vue.float_window import FloatWindow
from common.vue.label import ElementBaseLabel
from common.vue.label import ElementType as ET
from common.vue.region import VueRegion
from common.vue.search import VueSearch
from common.vue.table import VueTable, VueTurnPage
from common.vue.tree import VueTree


class Search(VueSearch):
    """查询区域"""
    keyword_dropdown_list = ElementBaseLabel(ET.DROPDOWN_LIST, label="关键字")  # 关键字后面的下拉选框
    keyword_input = ElementBaseLabel(ET.INPUT, label="关键字")  # 关键字后面的输入框
    region_grid_input = ElementBaseLabel(ET.GRID, label="网格")  # 区域后面的网格请选择框
    region_region_selector = VueRegion(index=0)  # region_dropdown_list选择区域时，点击region_input出现的
    region_grid_selector = VueTree(index=0, describe="查询区域的网格选择树")  # region_dropdown_list选择网格时，点击region_input出现的
    state_list = ElementBaseLabel(ET.DROPDOWN_LIST, label="状态")
    duty_list = ElementBaseLabel(ET.DROPDOWN_LIST, label="职务")
    search_btn = VueButton("检索")  # 查询按钮

    def __init__(self):
        super(Search, self).__init__()


class Table(VueTable):
    """人口表"""
    add_btn = VueButton("添加")

    def __init__(self):
        super(Table, self).__init__()


class AddGridUserManage(FloatWindow):
    """增加弹窗"""
    name = ElementBaseLabel(ET.INPUT, label="姓名")
    sex = ElementBaseLabel(ET.DROPDOWN_LIST, label="性别")
    nation = ElementBaseLabel(ET.INPUT, label="民族")
    background = ElementBaseLabel(ET.DROPDOWN_LIST, label="学历")
    politics_status = ElementBaseLabel(ET.DROPDOWN_LIST, label="政治面貌")
    phone = ElementBaseLabel(ET.INPUT, label="手机号码")
    date = ElementBaseLabel(ET.DATE_PICKER, label="出生日期")

    def __init__(self, title=None, index=None):
        super(AddGridUserManage, self).__init__(title=title, index=index)


class GridUserManageWindow(AddGridUserManage):
    """修改弹窗"""

    def __init__(self, title=None, index=None):
        super(GridUserManageWindow, self).__init__(title=title, index=index)


class GridUserManagePage(Page):
    turnPage = VueTurnPage()  # 翻页
    searchTools = Search()  # 查询区域
    table = Table()  # 列表
    addGridUserManage = AddGridUserManage(title='添加网格员')  # 添加人口弹窗
    modifyGridUserManage = GridUserManageWindow(title='编辑网格员')   # 修改人口弹窗